//
// CMeshBaseInstance.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;

public class CMeshBaseInstance {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CMeshBaseInstance(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CMeshBaseInstance obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        throw new UnsupportedOperationException("C++ destructor does not have public access");
      }
      swigCPtr = 0;
    }
  }

  public static void registerBasic() {
    nel3dJNI.CMeshBaseInstance_registerBasic();
  }

  public void setMaterials(SWIGTYPE_p_std__vectorT_NL3D__CMaterial_t value) {
    nel3dJNI.CMeshBaseInstance_Materials_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CMaterial_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CMaterial_t getMaterials() {
    long cPtr = nel3dJNI.CMeshBaseInstance_Materials_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_NL3D__CMaterial_t(cPtr, false);
  }

  public void setAsyncTextures(SWIGTYPE_p_std__vectorT_NL3D__CAsyncTextureBlock_t value) {
    nel3dJNI.CMeshBaseInstance_AsyncTextures_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CAsyncTextureBlock_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CAsyncTextureBlock_t getAsyncTextures() {
    long cPtr = nel3dJNI.CMeshBaseInstance_AsyncTextures_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_NL3D__CAsyncTextureBlock_t(cPtr, false);
  }

  public void registerToChannelMixer(CChannelMixer chanMixer, String prefix) {
    nel3dJNI.CMeshBaseInstance_registerToChannelMixer(swigCPtr, this, CChannelMixer.getCPtr(chanMixer), chanMixer, prefix);
  }

  public long getNumMaterial() {
    return nel3dJNI.CMeshBaseInstance_getNumMaterial(swigCPtr, this);
  }

  public CMaterial getMaterial(long materialId) {
    long cPtr = nel3dJNI.CMeshBaseInstance_getMaterial__SWIG_0(swigCPtr, this, materialId);
    return (cPtr == 0) ? null : new CMaterial(cPtr, false);
  }

  public ITrack getDefaultTrack(long valueId) {
    long cPtr = nel3dJNI.CMeshBaseInstance_getDefaultTrack(swigCPtr, this, valueId);
    return (cPtr == 0) ? null : new ITrack(cPtr, false);
  }

  public long getNbLightMap() {
    return nel3dJNI.CMeshBaseInstance_getNbLightMap(swigCPtr, this);
  }

  public void getLightMapName(long nLightMapNb, SWIGTYPE_p_std__string LightMapName) {
    nel3dJNI.CMeshBaseInstance_getLightMapName(swigCPtr, this, nLightMapNb, SWIGTYPE_p_std__string.getCPtr(LightMapName));
  }

  public void initAnimatedLightIndex(CScene scene) {
    nel3dJNI.CMeshBaseInstance_initAnimatedLightIndex(swigCPtr, this, CScene.getCPtr(scene), scene);
  }

  public long getNbBlendShape() {
    return nel3dJNI.CMeshBaseInstance_getNbBlendShape(swigCPtr, this);
  }

  public void getBlendShapeName(long nBlendShapeNb, SWIGTYPE_p_std__string BlendShapeName) {
    nel3dJNI.CMeshBaseInstance_getBlendShapeName(swigCPtr, this, nBlendShapeNb, SWIGTYPE_p_std__string.getCPtr(BlendShapeName));
  }

  public void setBlendShapeFactor(String BlendShapeName, float rFactor) {
    nel3dJNI.CMeshBaseInstance_setBlendShapeFactor(swigCPtr, this, BlendShapeName, rFactor);
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CAnimatedMorph_t getBlendShapeFactors() {
    long cPtr = nel3dJNI.CMeshBaseInstance_getBlendShapeFactors(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_NL3D__CAnimatedMorph_t(cPtr, false);
  }

  public void changeMRMDistanceSetup(float arg0, float arg1, float arg2) {
    nel3dJNI.CMeshBaseInstance_changeMRMDistanceSetup(swigCPtr, this, arg0, arg1, arg2);
  }

  public void selectTextureSet(long id) {
    nel3dJNI.CMeshBaseInstance_selectTextureSet(swigCPtr, this, id);
  }

  public void enableAsyncTextureMode(boolean enable) {
    nel3dJNI.CMeshBaseInstance_enableAsyncTextureMode(swigCPtr, this, enable);
  }

  public boolean getAsyncTextureMode() {
    return nel3dJNI.CMeshBaseInstance_getAsyncTextureMode(swigCPtr, this);
  }

  public void startAsyncTextureLoading(CVector position) {
    nel3dJNI.CMeshBaseInstance_startAsyncTextureLoading(swigCPtr, this, CVector.getCPtr(position), position);
  }

  public boolean isAsyncTextureReady() {
    return nel3dJNI.CMeshBaseInstance_isAsyncTextureReady(swigCPtr, this);
  }

  public void setAsyncTextureDistance(float dist) {
    nel3dJNI.CMeshBaseInstance_setAsyncTextureDistance(swigCPtr, this, dist);
  }

  public float getAsyncTextureDistance() {
    return nel3dJNI.CMeshBaseInstance_getAsyncTextureDistance(swigCPtr, this);
  }

  public void setAsyncTextureDirty(boolean flag) {
    nel3dJNI.CMeshBaseInstance_setAsyncTextureDirty(swigCPtr, this, flag);
  }

  public boolean isAsyncTextureDirty() {
    return nel3dJNI.CMeshBaseInstance_isAsyncTextureDirty(swigCPtr, this);
  }

  public int getAsyncTextureId(long matId, long stage) {
    return nel3dJNI.CMeshBaseInstance_getAsyncTextureId(swigCPtr, this, matId, stage);
  }

  public void traverseHrc() {
    nel3dJNI.CMeshBaseInstance_traverseHrc(swigCPtr, this);
  }

  public void traverseAnimDetail() {
    nel3dJNI.CMeshBaseInstance_traverseAnimDetail(swigCPtr, this);
  }

  public boolean fastIntersect(CVector p0, CVector dir, SWIGTYPE_p_float dist2D, SWIGTYPE_p_float distZ, boolean computeDist2D) {
    return nel3dJNI.CMeshBaseInstance_fastIntersect(swigCPtr, this, CVector.getCPtr(p0), p0, CVector.getCPtr(dir), dir, SWIGTYPE_p_float.getCPtr(dist2D), SWIGTYPE_p_float.getCPtr(distZ), computeDist2D);
  }

  public void set_VPWindTreePhase(float value) {
    nel3dJNI.CMeshBaseInstance__VPWindTreePhase_set(swigCPtr, this, value);
  }

  public float get_VPWindTreePhase() {
    return nel3dJNI.CMeshBaseInstance__VPWindTreePhase_get(swigCPtr, this);
  }

  public void set_VPWindTreeFixed(boolean value) {
    nel3dJNI.CMeshBaseInstance__VPWindTreeFixed_set(swigCPtr, this, value);
  }

  public boolean get_VPWindTreeFixed() {
    return nel3dJNI.CMeshBaseInstance__VPWindTreeFixed_get(swigCPtr, this);
  }

  public final static class TAnimValues {
    public final static TAnimValues OwnerBit = new TAnimValues("OwnerBit", nel3dJNI.CMeshBaseInstance_OwnerBit_get());
    public final static TAnimValues AnimValueLast = new TAnimValues("AnimValueLast");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TAnimValues swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TAnimValues.class + " with value " + swigValue);
    }

    private TAnimValues(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TAnimValues(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TAnimValues(String swigName, TAnimValues swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TAnimValues[] swigValues = { OwnerBit, AnimValueLast };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
